<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <input type="text" placeholder="员工姓名" v-model="p.name">
  <input type="text" placeholder="员工工资" v-model="p.salary">
  <input type="text" placeholder="员工工作" v-model="p.job">
  <input type="button" value="添加" @click="f()">
  <table border="1">
    <caption>员工列表</caption>
    <tr>
      <th>姓名</th>
      <th>工资</th>
      <th>工作</th>
      <th>操作</th>
    </tr>
    <tr v-for="(p,i) in arr">
      <td>{{p.name}}</td>
      <td>{{p.salary}}</td>
      <td>{{p.job}}</td>
      <td><input type="button" value="删除" @click="del(i)"></td>
    </tr>
  </table>
</div>
<script src="js/Vue.js"></script>
<script>
  Vue.createApp({
    data(){
      return{
        p:{name:"",salary:"",job:""},
        arr:[{name: "蔡徐坤",salary:"2333",job:"打篮球"},
          {name:"吴亦凡",salary: "2333",job:"踩缝纫机"}]
      }
    },
    methods:{
      f(){
        let newp={name:this.p.name,salary:this.p.salary,job:this.p.job}
        this.arr.push(newp)
      },
      del(i) {
        this.arr.splice(i,1);
      }
    }
  }).mount("body>div")
</script>
</body>
</html>